package view;

import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import model.State;

/**
 * @author Sarah George
 *
 */
@SuppressWarnings("serial")
public class NewPaperPanel extends JPanel {
	
	private State my_state;
	private JFrame my_frame;
	
	public NewPaperPanel(State the_state, JFrame the_frame) {
		super();
		my_state = the_state;
		my_frame = the_frame;
		setup();
	}

	public void setup() {
		GridLayout exp_layout = new GridLayout(0,2);
		JLabel title = new JLabel("Paper Title");
		JTextField title_field = new JTextField();
		JLabel author = new JLabel("Author");
		//JTextField author_field = new JTextField();
		JLabel author_field = new JLabel(my_state.getUser().getName());
		JLabel conference = new JLabel("Conference");
		//JTextField conf_field = new JTextField();
		JLabel conf_field = new JLabel(my_state.getConference().getConfName());
		JLabel abst = new JLabel("Abstract");
		JTextField abst_field = new JTextField();
		JTextField file_path_field = new JTextField();
		JFileChooser fc = new JFileChooser();
		BrowseAction browse = new BrowseAction(my_frame, fc, file_path_field);
		JButton bb = new JButton(browse);
		
		CloseAction cancel = new CloseAction(my_frame);
		JButton cancel_add = new JButton(cancel);
		cancel_add.setText("Cancel");
		SubmitPaperAction spa = new SubmitPaperAction(my_state, my_frame, title_field,
									abst_field, file_path_field);
		JButton submit = new JButton(spa);
		
		this.setLayout(exp_layout);
		this.add(title);
		this.add(title_field);
		this.add(author);
		this.add(author_field);
		this.add(conference);
		this.add(conf_field);
		this.add(abst);
		this.add(abst_field);
		this.add(file_path_field);
		this.add(bb);
		
		this.add(cancel_add);
		this.add(submit);
	}
}